/*
 */

#include <avr/io.h>

int main(void)
{

    // Insert code

    void spi_master_init(void)
    {
        DDRB = (1 << 2) | (1 << 1); // 1<<2 MOSI output ,1<<1 sck output
        SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR0); // SPI enable
    }
    void spi_master_transmit(uint8_t cData)
    {
        SPDR = cData;
        while (!(SPSR & (1 << SPIF)))
        ;
    }
    void spi_slave_init(void)
    {
        DDRB = (1 << 3); // 1 << 3 MISO output
        SPCR = (1 << SPE); //SPI enable
    }
    uint8_t spi_slave_receive(void)
    {
        while (!(SPSR & (1 << SPIF)))
        ;
        return SPDR;
    }
    while(1)
    ;

    return 0;
}
